package com.baturu.vin.dffx.dal.dao;

import com.baturu.vin.dffx.dto.DffxPartsInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Author: chenjiahao
 * @Time: 2018/9/27
 */
public interface DffxPartsInfoDAO {

    @Select({"<script>SELECT t1.partNumber partsCode, t1.name epcName,t1.startDate, t1.endDate,t1.remark,t1.series,t1.orderIndex,t1.partStructOid partStruOid,t1.oid,t1.parentOid",
            "FROM dffx_parts_info t1",
            "WHERE t1.series = #{series}",
            "AND t1.partNumber in",
            "<foreach item = 'item' index = 'index' collection = 'partsCode' open ='(' separator = ',' close = ')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DffxPartsInfoDTO> queryPartsBySeries(@Param("series") String series,@Param("partsCode") Set<String> partsCode);

    @Select({"<script>SELECT partNumber partsCode, name epcName,startDate, endDate,remark,series",
            "FROM dffx_parts_info",
            "WHERE partNumber in",
            "<foreach item = 'item' index = 'index' collection = 'partsCode' open ='(' separator = ',' close = ')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DffxPartsInfoDTO> queryPartsByPartsCode(@Param("partsCode") Set<String> partsCode);
}
